assume cs:code

data segment
        db 80 dup (' ')
        db 32 dup (' ')
        db 'welcome to masm!'
        db 32 dup (' ')

data ends

stack segment
        dw 0,0
stack ends

code segment
        start:mov ax, 0b800h
              mov ds, ax

              mov ax, data
              mov es, ax

              mov ax, stack
              mov ss, ax
              mov sp, 0

              mov bp, 0
              mov bx, 0
              mov si, 0

              mov cx, 50
              jmp short s
         
           s2:mov cx, 16
              mov bp, 0
              mov si, 0
           s3:
              mov al, es:[bp+80+32]
              mov ah, 02h
              mov ds:[bx+si+64], ax
              add si, 2
              inc bp
              loop s3
             
              add bx, 160
              
          s4: mov cx, 16
              mov bp, 0
              mov si, 0
          s5: mov al, es:[bp+80+32]
              mov ah, 24h
              mov ds:[bx+si+64], ax
              add si, 2
              inc bp
              loop s5

              add bx, 160

          s6: mov cx, 16
              mov bp, 0
              mov si, 0
          s7: mov al, es:[bp+80+32]
              mov ah, 71h
              mov ds:[bx+si+64], ax
              add si, 2
              inc bp
              loop s7
              jmp short s_end

            s:push cx
              mov cx, 80
              mov bp, 0
              mov si, 0
           s1:
              mov al, es:[bp]
              mov ah, 0
              mov ds:[bx+si], ax
              add si, 2
              inc bp
              loop s1

              pop cx
              add bx, 160
              loop s

              mov bx, 3680
              jmp short s2
              
        s_end:mov ax, 4c00h
              int 21h

code ends
end start
